<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.4.4.min.js"></script>
</head>
<body>
    <input type="button" value="查询" onclick="doQuery()">
    <input type="button" value="新增" onclick="doAdd()">
    <input type="button" value="删除" onclick="doDelete()">
    <input type="button" value="修改" onclick="doUpdate()">
</body>
<script>
    function doQuery() {
        //get请求
        $.ajax({
            type:"get",
            url:"/user/1",
            success: function(data) {
                console.log(data);
            }
        });
    }
    function doDelete() {
        //删除请求
        $.ajax({
            type:"delete",
            url:"/user/2",
            success: function(data) {
                console.log(data);
            }
        });
    }
    function doAdd() {
//删除请求
        $.ajax({
            type:"post",
            url:"/user/",
            data:"{\"id\":1,\"name\":\"zhangsan\"}",
            contentType: "application/json",
            success: function(data) {
                console.log(data);
            }
        });
    }
    function doUpdate() {
        //修改请求
        $.ajax({
            type:"put",
            url:"/user/",
            data:"{\"id\":1,\"name\":\"zhangsan\"}",
            contentType: "application/json",
            success: function(data) {
                console.log(data);
            }
        });
    }
</script>
</html>